/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("tb_project_billing",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using MYData.Entity.DomainModels;
using MYData.System.IServices;
using Microsoft.AspNetCore.Authorization;
 
using MYData.Core.Utilities;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System.IO;
using System.Data;
using MYData.Entity.DomainModels.ApiEntity.Dto;

namespace MYData.System.Controllers
{
    public partial class tb_project_billingController
    {
        private readonly Itb_project_billingService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public tb_project_billingController(
            Itb_project_billingService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        /// <summary>
        /// 入账单列表
        /// </summary>
        /// <param name = "informName" ></ param >
        /// < returns ></ returns >
        [HttpGet("BillingList"), AllowAnonymous]
        public async Task<IActionResult> BillingList(string billingUnit = "", string billingTime = "")
        {
            return Json(await Service.BillingList(billingUnit, billingTime));
        }
        /// <summary>
        /// 下拨列表的详情/反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("GetDetailBiillingList"), AllowAnonymous]
        public  IActionResult GetDetailBiillingList(string id)
        {
            return  Json( _service.GetDetailBiillingList(id));
        }
        /// <summary>
        /// 入账单列表的详情/回显
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// WJQ 2023/4/14
        [HttpGet("GetDetailBiilling"), AllowAnonymous]
        public async Task<WebResponseContent> GetDetailBiilling(string id)
        {
            return await _service.GetDetailBiilling(id);
        }
        /// <summary>
        /// 入账单添加
        /// </summary>
        /// <param name = "informName" ></ param >
        /// < returns ></ returns >
        [HttpPost("BiillingAdd"), AllowAnonymous]
        public IActionResult BiillingAdd([FromBody]tb_project_billing_appendixDto input)
        {
            return Json(Service.BiillingAdd(input));
        }
        /// <summary>
        /// Excel数据导出
        /// </summary>
        /// <returns></returns>
        [HttpGet("ExcelDataExport"), AllowAnonymous]
        public WebResponseContent ExcelDataExport()
        {
            return Service.ExcelDataExport();
        }
        /// <summary>
        /// 批量导入
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        [HttpPost("ExcelDataImport"),AllowAnonymous]
        public WebResponseContent ExcelDataImport(IFormFile file)
        {
            return Service.ExcelDataImport(file);
        }
        /// <summary>
        /// 导出word
        /// </summary>
        /// <returns></returns>
        [HttpGet("SaveWordFile"),AllowAnonymous]
        public WebResponseContent SaveWordFile()
        {
            return Service.SaveWordFile();
        }
    }
}
